package com.kavenka.zhufengfm.app.activity;

import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import com.kavenka.zhufengfm.app.BuildConfig;
import com.kavenka.zhufengfm.app.Constants;
import com.kavenka.zhufengfm.app.R;


public class WelcomeActivity extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);
        //4.在welcome页面保存sharePreference版本信息
        SharedPreferences sp = getSharedPreferences(Constants.SP_APP_NAME, MODE_PRIVATE);
        SharedPreferences.Editor editor=sp.edit();
        editor.putString(Constants.SP_CURRENT_VERSION, BuildConfig.VERSION_NAME);
        editor.commit();
    }
    //5.在welcome页面按返回键和点击右上角的按钮可以直接到mainActivity
    @Override
    public void onBackPressed() {
        btnGoMain(null);
    }
    public void btnGoMain(View view) {
        Intent intent=new Intent(WelcomeActivity.this,MainActivity.class);
        startActivity(intent);
        finish();
    }
}
